Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PowerShell completion file #1826

Merged
merged 5 commits into from
Aug 28, 2021
Merged

Conversation

rashil2000
Copy link
Contributor

No description provided.

@rashil2000
Copy link
Contributor Author

@Enselic The file extension needs to be .ps1, otherwise PowerShell won't be able to source it.

@Enselic
Copy link
Collaborator

Enselic commented Aug 28, 2021

@rashil2000 Sorry to mess up the PR, I thought I knew what I was doing, but now CI fails. Any chance you can take over, since you know what needs to be done? My goal was to package the completion file in the tar.gzs and .zips that our CI pipeline build. You can download CI artifacts here to confirm that the file is included and usable: https://github.com/sharkdp/bat/actions/runs/1174961314. (But of course the link is different for each CI run.)

We also build .debs, but I didn't touch those since I don't know the proper path to put it at. It possibly does not make sense to add it there at all.

@rashil2000
Copy link
Contributor Author

The CI was failing because the file bat.pwsh didn't exist. It's fixed now.

.github/workflows/CICD.yml Outdated Show resolved Hide resolved
@Enselic
Copy link
Collaborator

Enselic commented Aug 28, 2021

Thanks! I can confirm that _bat.ps1 is packaged in e.g. bat-v0.18.3-i686-pc-windows-msvc.zip now.

Can you also add an entry about this to CHANGELOG.md as per instructions in https://github.com/sharkdp/bat/blob/master/CONTRIBUTING.md#add-an-entry-to-the-changelog please? Thanks in advance!

(I'm setting Approved already now)

Copy link
Owner

@sharkdp sharkdp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@Enselic Enselic merged commit 43afae3 into sharkdp:master Aug 28, 2021
@rashil2000 rashil2000 deleted the pwsh-complete branch August 28, 2021 13:03
@Hrxn
Copy link

Hrxn commented Jun 3, 2022

Maybe it should also be mentioned how to use the PowerShell completion file?
I mean, I don't think that this is immediately obvious..

@rashil2000
Copy link
Contributor Author

Completion files are usually dot-sourced. For example you can put this line in your $PROFILE:

. /file/path/to/_bat.ps1

@Hrxn
Copy link

Hrxn commented Jun 4, 2022

I'm aware, I was just a bit surprised because this does not seem to be mentioned anywhere on the project site. Although it could arguably be considered part of the install instructions, in my opinion.

For what's it worth, it could also be considered presumed knowledge for a PowerShell user, but still..

Speaking of presumed knowledge, why does the name of that file start with an underscore character (_)?
Is that some sort of new PowerShell convention as well?

@rashil2000
Copy link
Contributor Author

Is that some sort of new PowerShell convention as well?

It does seem like a convention. I've seen it in many places.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants